home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6425 < prev    next >
Encoding:
Text File  |  1996-08-05  |  6.8 KB  |  241 lines

  1. Path: sn.no!usenet
  2. From: elvemo@sn.no (Rune Elvemo)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Problem with BOOPSI
  5. Date: 27 Mar 1996 17:13:18 GMT
  6. Organization: SN Internett
  7. Message-ID: <6593.6660T1030T543@sn.no>
  8. NNTP-Posting-Host: sinsen.sn.no
  9. Priority: Urgent
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  11.  
  12. I have a problem with a BOOPSI system. I have set up all the gagdets to
  13. communicate using ICA_MAP and a Class under ModelClass. When I press one of
  14. the buttons I *always* get a Guru.
  15.  
  16. Here goes the source (I have only one gadget in this one, but later I will
  17. include to buttons (up and down buttons for the prop).
  18.  
  19. As you can see from the source bellow, I use the RKMModel, which can be found
  20. in RKRM:Libraries. (I *had* one that I made by myself, but I think there was
  21. something wrong with it :-( ).
  22.  
  23. You migh want to know, that I removed the line in the dispather routine in
  24. RKMModel, saying : "geta4()". I don't know this is what's causing the Gurus.
  25.  
  26. ---------------------- !Clip Here! ------------------------
  27.  
  28. #include <exec/types.h>
  29. #include <intuition/intuition.h>
  30. #include <intuition/screens.h>
  31. #include <intuition/classes.h>
  32. #include <intuition/classusr.h>
  33. #include <intuition/gadgetclass.h>
  34. #include <intuition/imageclass.h>
  35. #include <intuition/cghooks.h>
  36. #include <intuition/icclass.h>
  37. #include <utility/tagitem.h>
  38. #include <utility/hooks.h>
  39.  
  40. #include <clib/intuition_protos.h>
  41. #include <clib/exec_protos.h>
  42. #include <clib/utility_protos.h>
  43. #include <clib/alib_protos.h>
  44. #include <clib/alib_stdio_protos.h>
  45.  
  46. #include "dsamples:RKMModel.c"
  47.  
  48. struct Library *IntuitionBase;
  49. struct Library *UtilityBase;
  50.  
  51. Class *EdModCl;
  52.  
  53. Object *ed_model, *curr2prop;
  54.  
  55. struct Gadget *prop;
  56.  
  57. #define PROPGADID 1L
  58.  
  59. struct TagItem prop2ed[] =
  60. {
  61.         {PGA_Top, RKMMOD_CurrVal},
  62.         {TAG_END,}
  63. };
  64.  
  65. struct TagItem ed2prop[] =
  66. {
  67.         {RKMMOD_CurrVal, PGA_Top},
  68.         {TAG_END,}
  69. };
  70.  
  71. struct Screen *wb;
  72. struct Window *win;
  73.  
  74. /* prototype */
  75. BOOL MakeEnv(void);
  76. void handleIDCMP(void);
  77.  
  78. main()
  79. {
  80. BOOL Continue;
  81. ULONG *test;
  82.  
  83. if (IntuitionBase = OpenLibrary("intuition.library", 37))
  84.         {
  85.         if (UtilityBase = OpenLibrary("utility.library", 37))
  86.                 {
  87.                 if (EdModCl = initRKMModClass())
  88.                         {
  89.                         if (wb = LockPubScreen("Workbench"))
  90.                                 {
  91.                                 if (Continue = MakeEnv())
  92.                                         {
  93.                                         DoMethod(ed_model, OM_ADDMEMBER,
  94. curr2prop);
  95.  
  96.                                         if (win = OpenWindowTags(NULL,
  97.                                          WA_Top, wb->BarHeight,
  98.                                          WA_Left, 0,
  99.                                          WA_Width, wb->Width,
  100.                                          WA_Height,
  101.                                          (wb->Height - wb->BarHeight),
  102.                                            WA_Title, "Test
  103.                                            of the
  104.                                            ED_Mod",
  105.                                           WA_PubScreen, wb,
  106.                                           WA_MinWidth, 20,
  107.                                          WA_MinHeight, 10,
  108.                                          WA_Flags, WFLG_SIZEGADGET |
  109.                                                    WFLG_DRAGBAR |
  110.                                                    WFLG_DEPTHGADGET |
  111.                                                    WFLG_CLOSEGADGET,
  112.                                           WA_IDCMP, IDCMP_CLOSEWINDOW,
  113.                                           WA_Gadgets, prop,
  114.                                           TAG_END))
  115.                                                 {
  116.  
  117.                                           handleIDCMP();
  118.  
  119.                                           DisposeObject(ed_model);
  120.                                           DisposeObject(prop);
  121.  
  122.                                           CloseWindow(win);
  123.                                                 }
  124.                                         }
  125.                                 UnlockPubScreen(NULL, wb);
  126.                                 }
  127.                         freeRKMModClass(EdModCl);
  128.                         }
  129.                 CloseLibrary(UtilityBase);
  130.                 }
  131.         CloseLibrary(IntuitionBase);
  132.         }
  133. }
  134.  
  135. /* ::: Make the evniroment ::: */
  136. BOOL MakeEnv(void)
  137. {
  138. BOOL AllDone = FALSE;
  139. ULONG WinTopBor = (wb->WBorTop) + (wb->Font->ta_YSize) + 1; /* Height of the
  140. Top Border of the window */
  141.  
  142. int left = 3;
  143.  
  144. if (ed_model = NewObject(EdModCl, NULL,
  145.                 RKMMOD_Limit, 10,
  146.                 RKMMOD_CurrVal, 0,
  147.                 TAG_END))
  148.         {
  149.         left--;
  150.  
  151.         if(prop = NewObject (NULL, "propgclass",
  152.                         GA_ID, PROPGADID,
  153.                         GA_Top, (WinTopBor + 1),
  154.                         GA_RelRight, -13,
  155.                         GA_Width, 10,
  156.                         GA_RelHeight, -(WinTopBor +12),
  157.  
  158.                         ICA_MAP, prop2ed,
  159.                         ICA_TARGET, ed_model,
  160.  
  161.                         PGA_Freedom, FREEVERT,
  162.                         PGA_NewLook, TRUE,
  163.                         PGA_Borderless, TRUE,
  164.  
  165.                         PGA_Top, 0,
  166.                         PGA_Total, 100,
  167.                         PGA_Visible, 10,
  168.  
  169.                         TAG_END))
  170.                 {
  171.                 left--;
  172.  
  173.                 if(curr2prop = NewObject(NULL, "icclass",
  174.                                 ICA_MAP, ed2prop,
  175.                                 ICA_TARGET, ed_model,
  176.                                 TAG_END))
  177.                         {
  178.                         left--;
  179.  
  180.                         }
  181.                 }
  182.         }
  183. printf("Left = %d\n", left);
  184.  
  185. switch(left)
  186.         {
  187.         case 2:
  188.                 DisposeObject(ed_model);
  189.                 printf("here! 1\n");
  190.  
  191.                 break;
  192.  
  193.         case 1:
  194.                 DisposeObject(ed_model);
  195.                 DisposeObject(prop);
  196.                 printf("here! 2\n");
  197.  
  198.                 break;
  199.  
  200.         case 0:
  201.                 AllDone = TRUE;
  202.                 printf("here! 3\n");
  203.  
  204.                 break;
  205.         }
  206. }
  207.  
  208. /* Take care of *one* of the signals arriving at our port */
  209. void handleIDCMP(void)
  210. {
  211. struct IntuiMessage *msg;
  212. BOOL done = FALSE;
  213. ULONG Class;
  214.  
  215. while (!done)
  216.         {
  217.         Wait(1L << win->UserPort->mp_SigBit);
  218.  
  219.         while (msg = GetMsg(win->UserPort))
  220.                 {
  221.                 Class = msg->Class;
  222.  
  223.                 ReplyMsg(msg);
  224.  
  225.                 switch(Class)
  226.                         {
  227.                         case IDCMP_CLOSEWINDOW:
  228.                                 done = TRUE;
  229.                                 break;
  230.                         }
  231.                 }
  232.         }
  233. }
  234.  
  235. ---------------------- !Clip Here! ------------------------
  236.  
  237. Rune Elvemo
  238. elvemo@sn.no
  239. -It's cool to be clear :-)
  240.  
  241.